package linuxbox.reservation.logic;

import java.sql.Timestamp;

public class BoxReservationRepeatEntry
{
  public final static int BY_WEEK = 1;
  public final static int BY_WEEK_OF_MONTH = 2;
  public final static int BY_MONTH = 3;
  public final static int BY_YEAR  = 4;

  protected int m_iID;
  protected int m_iType; //repeat by Week, week of month, month, year
  protected Timestamp m_UntilTime;
	protected int m_iEvery; //every 1-4 weeks or months
	protected int m_DayOfWeek=0; //A bit array indicate sun, mon, tue.. Sat.
  protected int m_iWhichDay;  //Which week of month

  public void copyFrom(BoxReservationRepeatEntry entry)
  {
    m_iID = entry.getID();
    m_iType = entry.getType();
    m_iEvery = entry.getEvery();
    m_DayOfWeek = entry.getDayOfWeek();
    m_iWhichDay = entry.getWhichDay();
    
    if (entry.getUntilTime() == null)
      m_UntilTime = null;
    else
      m_UntilTime = new Timestamp(entry.getUntilTime().getTime());
  }

  public int getID()
	{
		return m_iID;
	}

  public void setID(int id)
	{
	  m_iID = id;
	}
  
  public int getType()
	{
		return m_iType;
	}

  public void setType(int i)
	{
	  m_iType = i;
	}
  
  public Timestamp getUntilTime()
	{
		return m_UntilTime;
	}

  public void setUntilTime(Timestamp tm)
	{
	  m_UntilTime = tm;
	}
  
  public int getEvery()
	{
		return m_iEvery;
	}

  public void setEvery(int i)
	{
	  m_iEvery = i;
	}
  
  public int getDayOfWeek()
	{
  	return m_DayOfWeek;
	}
  public void setDayOfWeek(int i)
	{
	  m_DayOfWeek = i;
	}

  public int getWhichDay()
	{
  	return m_iWhichDay;
	}

  public void setWhichDay(int i)
	{
	  m_iWhichDay = i;
	}

  public String toString()
  {
	  String s = "id=" + m_iID
				  + ", m_iType=" + m_iType
				  + ", m_UntilTime=" + m_UntilTime
	                + ", m_iEvery=" + m_iEvery
	                + ", m_DayOfWeek=" + m_DayOfWeek
	                + ", m_iWhichDay=" + m_iWhichDay
				  + "\n";
	  return s;
  }  
}